<template>
  <x-layout-main>
    <n-modal
      v-model:show="show"
      :bordered="false"
      :style="{ width: '800px' }"
      class="custom-card"
      preset="card"
      :mask-closable="false"
      @close="handleSubmit"
    >
      <template #header> 失败详情 </template>
      <div>
        <x-data-table
          ref="tableRef"
          v-model:immediate="immediate"
          :params="paginationParams"
          :columns="columns"
          :row-key="(row) => row.id"
          :is-reload="false"
          row-class-name="text-sm"
          max-height="infinite"
        />
      </div>
      <template #footer>
        <n-space justify="end">
          <x-button @click="handleBack()">返回上一步</x-button>
          <x-button type="primary" @click="handleSubmit">继续保存</x-button>
        </n-space>
      </template>
    </n-modal>
  </x-layout-main>
</template>

<script setup lang="ts">
  import { XButton, XLayoutMain, XDataTable } from '@/components'
  import { NModal, NSpace, NText, useMessage } from 'naive-ui'
  import { computed, ref } from 'vue'
  import { useRoute, useRouter } from 'vue-router'
  const show = ref(true)
  const message = useMessage()
  const route = useRoute()
  const router = useRouter()

  const immediate = ref(true)
  const paginationParams = computed(() => {
    return {
      actions: 'system/mediaAccountFailList',
      data: {
        uuid: route.query.uuid
      }
    }
  })
  const columns = ref([
    {
      title: '账户ID',
      key: 'accountCode'
    },
    {
      title: '账户名称',
      key: 'accountName'
    },
    {
      title: '主体名称',
      key: 'mdmName'
    },
    {
      title: '提示',
      key: 'errorMsg'
    }
  ])
  function handleSubmit() {
    show.value = false
    router.push({
      name: 'Adv'
    })
  }
  function handleBack() {
    // if (+route.query.type === 1) {
    window.history.go(-1)
    // } else {
    //   window.history.go(-2)
    // }
  }
</script>

<style scoped lang="scss"></style>
